<?php 
class showscreen{
	public $pos=0;
	public $filename='';
	public $host='';
	public $car_datetime='';
	public $timedatabase='';
	public $calendar='';
	public $year='';
	public $hours='';
	public $minutes='';
	public $camera_type='';
	public $lens_type='';
	public $distance='';
	public $name='';
	public $id='';
	public $triger_type='';
	public $timeout='';
	public $timecurren='';
	public $platecar='';
	public $vstriger_type='';	
	public $image='';
	public $path='';
	public $light='-1';
	public $idx=0;
	function Instance($pos,$filename,$host,$car_datetime,$camera_type,$lens_type,$name,$id,$triger_type,$timeout){
		$this->pos=$pos;
		$this->filename=$filename;
		$this->host=$host;
		$this->car_datetime=$car_datetime;
		$this->camera_type=$camera_type;
		$this->lens_type=$lens_type;
		$this->name=$name;
		$this->id=$id;
		$this->triger_type=$triger_type;
		$this->timeout=$timeout;
		$this->timedatabase=strtotime($car_datetime);
		$this->calendar = date('Ymd',$this->timedatabase);
		$this->year =date('Y',$this->timedatabase);
		$this->hours =date('H',$this->timedatabase);
		$this->minutes =date('i',$this->timedatabase);
		$this->distance=$camera_type.'-'.$lens_type;
		$this->vstriger_type=$id.'/'.substr($triger_type, 0,1);
		$mplatecar =explode('_',$filename);
		$this->platecar=str_replace('+','',$mplatecar[4]);
		$this->timecurren= $_SERVER['REQUEST_TIME'] - ($timeout*60*60);
		$this->image='http://'.$host.'/'.$this->year.'/'.$this->calendar.'/'.$this->hours.'/'.$this->minutes.'/'.$filename;
		$this->path=$host.'/'.$this->year.'/'.$this->calendar .'/'.$this->hours.'/'.$this->minutes.'/'.$filename;
		if($this->timecurren<$this->timedatabase){
			$this->light=1;
		}else{
			$this->light=0;
		}
	}
	function Instanceview($filename,$host,$car_datetime,$camera_type,$lens_type,$name,$id,$triger_type,$timeout,$carnumber,$idx){
		$this->idx=$idx;
		$this->filename=$filename;
		$this->host=$host;
		$this->car_datetime=$car_datetime;
		$this->camera_type=$camera_type;
		$this->lens_type=$lens_type;
		$this->name=$name;
		$this->id=$id;
		$this->triger_type=$triger_type;
		$this->timeout=$timeout;
		$this->timedatabase=strtotime($car_datetime);
		$this->calendar = date('Ymd',$this->timedatabase);
		$this->year =date('Y',$this->timedatabase);
		$this->hours =date('H',$this->timedatabase);
		$this->minutes =date('i',$this->timedatabase);
		$this->distance=$camera_type.'-'.$lens_type;
		$this->vstriger_type=$id.'/'.substr($triger_type, 0,1);
		$this->platecar=$carnumber;
		$this->timecurren= $_SERVER['REQUEST_TIME']  - ($timeout*60*60);
		$this->image='http://'.$host.'/'.$this->year.'/'.$this->calendar.'/'.$this->hours.'/'.$this->minutes.'/'.$filename;
		$this->path=$host.'/'.$this->year.'/'.$this->calendar.'/'.$this->hours.'/'.$this->minutes.'/'.$filename;
		if($this->timecurren<$this->timedatabase){
			$this->light=1;
		}else{
			$this->light=0;
		}
	}
	function GetPath($id,$name,$car_datetime,$carnumber,$host,$filename,$isReg){
		$this->filename=$filename;
		$this->host=$host;//
		$this->car_datetime=$car_datetime;
		$this->name=$name;
		$this->id=$id;
		$this->timedatabase=strtotime($car_datetime);
		$this->calendar = date('Ymd',$this->timedatabase);
		$this->year =date('Y',$this->timedatabase);
		$this->hours =date('H',$this->timedatabase);
		$this->minutes =date('i',$this->timedatabase);
		$this->image='http://'.$host.'/'.$this->year.'/'.$this->calendar.'/'.$this->hours.'/'.$this->minutes.'/'.$filename;
	}
}
?>
